
#include "nx_api.h"

#ifdef __PRODUCT_NETXDUO__
#include "netx_mdns_test.h"

/* Frame (96 bytes) */
static const unsigned char pkt1[96] = {
0x33, 0x33, 0x00, 0x00, 0x00, 0xfb, 0xec, 0x17, /* 33...... */
0x2f, 0xbd, 0xa4, 0xb1, 0x86, 0xdd, 0x60, 0x00, /* /.....`. */
0x00, 0x00, 0x00, 0x2a, 0x11, 0xff, 0x20, 0x01, /* ...*.. . */
0x0d, 0xb1, 0x00, 0x00, 0xf1, 0x01, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x02, /* ........ */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x00, 0x00, 0x00, 0xfb, 0x14, 0xe9, /* ........ */
0x14, 0xe9, 0x00, 0x2a, 0xb0, 0x29, 0x00, 0x00, /* ...*.).. */
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, /* ..._http */
0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, /* ._tcp.lo */
0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01  /* cal..... */
};

/* Frame (466 bytes) */
static const unsigned char pkt2[466] = {
0x33, 0x33, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x11, /* 33...... */
0x22, 0x33, 0x44, 0x57, 0x86, 0xdd, 0x60, 0x00, /* "3DW..`. */
0x00, 0x00, 0x01, 0x9c, 0x11, 0xff, 0xfe, 0x80, /* ........ */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, /* ........ */
0x22, 0xff, 0xfe, 0x33, 0x44, 0x57, 0xff, 0x02, /* "..3DW.. */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x00, 0x00, 0x00, 0xfb, 0x14, 0xe9, /* ........ */
0x14, 0xe9, 0x01, 0x9c, 0xa2, 0xa8, 0x00, 0x00, /* ........ */
0x84, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, /* ........ */
0x00, 0x06, 0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, /* ..._http */
0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, /* ._tcp.lo */
0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01, /* cal..... */
0x00, 0x00, 0x00, 0x64, 0x00, 0x1e, 0x0b, 0x41, /* ...d...A */
0x52, 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, /* RMMDNSTe */
0x73, 0x74, 0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, /* st._http */
0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, /* ._tcp.lo */
0x63, 0x61, 0x6c, 0x00, 0x0b, 0x41, 0x52, 0x4d, /* cal..ARM */
0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, 0x74, /* MDNSTest */
0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, /* .local.. */
0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, /* ......x. */
0x04, 0x0a, 0x00, 0x00, 0x42, 0x0b, 0x41, 0x52, /* ....B.AR */
0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, /* MMDNSTes */
0x74, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* t.local. */
0x00, 0x1c, 0x80, 0x01, 0x00, 0x00, 0x00, 0x78, /* .......x */
0x00, 0x10, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x02, 0x11, 0x22, 0xff, 0xfe, 0x33, /* ...."..3 */
0x44, 0x57, 0x0b, 0x41, 0x52, 0x4d, 0x4d, 0x44, /* DW.ARMMD */
0x4e, 0x53, 0x54, 0x65, 0x73, 0x74, 0x05, 0x6c, /* NSTest.l */
0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x2f, 0x80, /* ocal../. */
0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x19, 0x0b, /* ....x... */
0x41, 0x52, 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, /* ARMMDNST */
0x65, 0x73, 0x74, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* est.loca */
0x6c, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x08, /* l...@... */
0x0b, 0x41, 0x52, 0x4d, 0x4d, 0x44, 0x4e, 0x53, /* .ARMMDNS */
0x54, 0x65, 0x73, 0x74, 0x05, 0x5f, 0x68, 0x74, /* Test._ht */
0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* tp._tcp. */
0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x21, /* local..! */
0x80, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x19, /* .....d.. */
0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x0b, 0x41, /* .....P.A */
0x52, 0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, /* RMMDNSTe */
0x73, 0x74, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, /* st.local */
0x00, 0x0b, 0x41, 0x52, 0x4d, 0x4d, 0x44, 0x4e, /* ..ARMMDN */
0x53, 0x54, 0x65, 0x73, 0x74, 0x05, 0x5f, 0x68, /* STest._h */
0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ttp._tcp */
0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, /* .local.. */
0x10, 0x80, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, /* ......d. */
0x14, 0x08, 0x70, 0x61, 0x70, 0x65, 0x72, 0x3d, /* ..paper= */
0x41, 0x34, 0x0a, 0x76, 0x65, 0x72, 0x73, 0x69, /* A4.versi */
0x6f, 0x6e, 0x3d, 0x30, 0x31, 0x0b, 0x41, 0x52, /* on=01.AR */
0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, /* MMDNSTes */
0x74, 0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x04, /* t._http. */
0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, /* _tcp.loc */
0x61, 0x6c, 0x00, 0x00, 0x2f, 0x80, 0x01, 0x00, /* al../... */
0x00, 0x00, 0x78, 0x00, 0x25, 0x0b, 0x41, 0x52, /* ..x.%.AR */
0x4d, 0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, /* MMDNSTes */
0x74, 0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x04, /* t._http. */
0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, /* _tcp.loc */
0x61, 0x6c, 0x00, 0x00, 0x05, 0x00, 0x00, 0x80, /* al...... */
0x00, 0x40                                      /* .@ */
};

/* Frame (122 bytes) */
static const unsigned char pkt3[122] = {
0x33, 0x33, 0x00, 0x00, 0x00, 0xfb, 0xec, 0x17, /* 33...... */
0x2f, 0xbd, 0xa4, 0xb1, 0x86, 0xdd, 0x60, 0x00, /* /.....`. */
0x00, 0x00, 0x00, 0x44, 0x11, 0xff, 0x20, 0x01, /* ...D.. . */
0x0d, 0xb1, 0x00, 0x00, 0xf1, 0x01, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x02, /* ........ */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x00, 0x00, 0x00, 0xfb, 0x14, 0xe9, /* ........ */
0x14, 0xe9, 0x00, 0x44, 0x6e, 0x5c, 0x00, 0x00, /* ...Dn\.. */
0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, /* ..._http */
0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, /* ._tcp.lo */
0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01, /* cal..... */
0xc0, 0x0c, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x00, /* ........ */
0x00, 0x64, 0x00, 0x0e, 0x0b, 0x41, 0x52, 0x4d, /* .d...ARM */
0x4d, 0x44, 0x4e, 0x53, 0x54, 0x65, 0x73, 0x74, /* MDNSTest */
0xc0, 0x0c                                      /* .. */
};

static MDNS_SERVICE mdns_service = {"ARMMDNSTest", "_http._tcp", NX_NULL, "paper=A4;version=01", 100, 0, 0, 80, NX_MDNS_RR_SET_UNIQUE, 0};

MDNS_TEST_SEQ mdns_basic_ipv6_response[] = {
    {TITLE, "Basic IPv6 response", 19, 0},

    /* Add link local address. */
    {MDNS_LLA_ADD, NX_NULL, 0x00000011, 0x22334457},
    {WAIT, NX_NULL, 0, 5},

    /* Recreate mDNS. */
    {MDNS_RECREATE, "ARMMDNSTest", 0, 0},

    /* Add service. */
    {MDNS_SERVICE_ADD, (char*)&mdns_service, 0, 0},
    {WAIT, NX_NULL, 0, 5},
    {DUMP, NX_NULL, 0, 0},

    /* Inject query. */
    {INJECT, (char*)&pkt1[0], sizeof(pkt1), 0},

    /* Check response. */
    {MDNS_CHECK_DATA_V6, (char*)&pkt2[0], sizeof(pkt2), 3},

    /* Inject query. */
    {INJECT, (char*)&pkt3[0], sizeof(pkt3), 0},

    /* No response is expected. */
    {N_CHECK, NX_NULL, 0, 1},

    /* Delete link local address. */
    {MDNS_LLA_DELETE, NX_NULL, 0, 0},
};

int mdns_basic_ipv6_response_size = sizeof(mdns_basic_ipv6_response) / sizeof(MDNS_TEST_SEQ);

#endif /* __PRODUCT_NETXDUO__  */
